import java.util.Arrays;

class Solution {
    public String largestNumber(int[] nums) {
        int n= nums.length;
        String[] str=new String[n];
        for (int i = 0; i < n; i++) {
            str[i]=""+nums[i];
        }
        Arrays.sort(str,(a,b)->{
            return (b+a).compareTo(a+b);
        });
        StringBuffer buffer=new StringBuffer();
        for (String num : str) {
            buffer.append(num);
        }
        if(buffer.charAt(0)=='0'){
            return "0";
        }
        return buffer.toString();
    }
}